<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" CodeBehind="EditGalleries.aspx.cs" Inherits="Impact.Web.Admin.EditGalleries" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table class="AdminTable">
        <tr>
            <th>Galleries</th>
            <th class="NonHeader">Photos</th>
            <th class="NonHeader">Visible</th>
            <th class="NonHeader">Delete</th>
        </tr>
        
    <asp:Repeater ID="galleryList" runat="server" OnItemCommand="GalleryList_ItemCommand">
        <ItemTemplate>
            <tr>
                <td style="width: 200px; text-align: left; padding-left: 30px;">
                    <%# Eval("Name") %>
                </td>
                
                <td style="text-align: center;">[<%# GetPhotoCount(Container.DataItem) %>]</td>
                
                <td style="text-align: center;">
                    <asp:ImageButton ID="enabledButton" CommandName="toggle" CommandArgument='<%# Eval("GalleryId") %>' 
                        ImageUrl='<%# Convert.ToBoolean(Eval("Visible")) ? "images/checked.png" : "images/unchecked.png" %>' runat="server" />
                </td>                
                                        
                <td style="text-align: center;">
                    <asp:ImageButton ID="deleteButton" CommandName="delete" CommandArgument='<%# Eval("GalleryId") %>'
                        ImageUrl="images/red-x.png" runat="server" />
                </td>
            </tr>
                               
        </ItemTemplate>
    </asp:Repeater>
    
    <asp:Panel ID="noGalleriesPanel" Visible="false" runat="server">
        <tr>
            <td colspan="7">There have been no galleries defined yet.</td>
        </tr>
    </asp:Panel>
    
        <tr>
            <td colspan="2" style="text-align: center;">
                <impact:ImageLinkButton ID="addGalleryButton" CssClass="AdminTableButton" Style="" runat="server"
                    ImageUrl="images/add.png" Text="Add Gallery" OnCommand="AddGallery_Command" />
                <asp:Panel ID="newGalleryPanel" Visible="false" runat="server">
                    <div style="margin: 10px;">New Gallery: <asp:TextBox ID="newGalleryName" runat="server" /></div>
                    <impact:SubmitCancel id="newGallerySubmit" OnSubmit="NewGallerySubmit" OnCancel="NewGalleryCancel" runat="server" />
                </asp:Panel>
                
            </td>
        </tr>
    </table>



</asp:Content>